[iphone] use NSString in other method?!

Posted by user134282 on Stack Overflow See other posts from Stack Overflow or by user134282
Published on 2009-11-23T09:47:47Z Indexed on 2010/06/15 0:12 UTC
Read the original article Hit count: 153

Filed under:
|
|

It's really embarrassing but i stuck on it for two hours of trial and error.

I declared an NSString in the interface as:

NSString *testString;

Then i made a property and synthesized it. I allocate it in viewDidLoad with:

testString = [[NSString alloc] initWithFormat:@"thats my value: %i", row];

If i want to get the value of the string in another method it always return (null). So the string is empty, but why? how do i make it accessible for every function inside of one class? So i don't want to make a global var just a "global variable inside the class"

It's really confusing because as long as i code i never ran into this problem :(

thanks a lot for helping me!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsstring